Repository navigation
Send Aspire telemetry to Grafana as well, when asked to - #1121
Open
KrzysztofPajak wants to merge 1 commit into
Open
KrzysztofPajak wants to merge 1 commit into
KrzysztofPajak wants to merge 1 commit into
Conversation
The Aspire AppHost points every app's OTLP exporter at its dashboard, and an exporter takes one endpoint only. With Observability:Grafana set, the AppHost starts an OpenTelemetry Collector in that place, which sends traces, metrics and logs on to both the dashboard and a grafana/otel-lgtm container (Tempo, Prometheus, Loki, Grafana). Off by default, so a plain run pulls nothing more.
| //an app exports to one OTLP endpoint only, which Aspire points at its dashboard - the collector takes | ||
| //that place and sends everything on to both the dashboard and Grafana | ||
| builder.AddOpenTelemetryCollector("otel-collector", settings => settings.CollectorTag = "0.165.0") | ||
| .WithConfig(Path.Combine(builder.AppHostDirectory, "otel-collector.yaml")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: feature
Issue
GrandNode already exports traces, metrics and logs through OpenTelemetry (
Aspire.ServiceDefaults), and an installation can point them at any OTLP backend. Locally, though, the Aspire AppHost shows them only in its own dashboard: it sets each app'sOTEL_EXPORTER_OTLP_ENDPOINTto the dashboard, and an exporter takes one endpoint only. There was no way to try the usual production setup - OpenTelemetry Collector in front of Grafana - without building it by hand.Solution
A switch in the AppHost,
Observability:Grafana(defaultfalse). When it is on, the AppHost also starts:grafana/otel-lgtm0.40.0 - Grafana with Tempo, Prometheus and Loki in one container, persistent, data in thegrandnode-grafanavolume;CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector(MIT).WithAppForwarding()points the apps at the collector instead of the dashboard, andotel-collector.yamlsends every signal on to both the dashboard and Grafana.The apps are not changed - their existing OTLP exporter does the work. The section "Telemetry in Grafana" in
docs/development.mdexplains the switch; it is appended at the end of the file so it does not collide with #1120.Breaking changes
None. The switch is off by default, so a plain AppHost run starts exactly what it did before.
Testing
Observability__Grafana=true dotnet run --project src/Aspire/Aspire.AppHost --launch-profile https.grafanaandotel-collector; both become healthy before thegrand-webreplicas start.grand-webreplica a few times.grafanaresource's URL: Explore → Tempo showsGETtraces ofgrand-web, Loki shows its logs (service_name="grand-web"), Prometheus has thegrandnode/grand-webjob.otel-collector's console has no "Exporting failed" lines.grafanaorotel-collectorresource appears.